﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace TvGuide.UI
{
    // Note: For instructions on enabling IIS6 or IIS7 classic mode, 
    // visit http://go.microsoft.com/?LinkId=9394801

    public class MvcApplication : System.Web.HttpApplication
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

        //routes.MapRoute(
        //    "Default", // Route name
        //    "",
        //    new { controller = "Home", action = "Home", lng = "eng" } // Parameter defaults
        //);

            routes.MapRoute(
          "SocialNetworkShare", // Route name
          "{lng}/Share/{ch}/{id}", // URL with parameters
          new { controller = "Home", action = "ShareSocial", lng = UrlParameter.Optional, name = UrlParameter.Optional } // Parameter defaults
          );

            routes.MapRoute(
           "OnlineTvRoute", // Route name
           "{lng}/Watch/{name}", // URL with parameters
           new { controller = "OnlineTV", action = "OnlineTV", lng = UrlParameter.Optional, name = UrlParameter.Optional } // Parameter defaults
           );

            routes.MapRoute(
            "JSONForSearch", // Route name
            "GetJSONResults/{query}", // URL with parameters
            new { controller = "Search", action = "GetJSONResults", query = UrlParameter.Optional } // Parameter defaults
            );

            routes.MapRoute(
                "Search", // Route name
                "{lng}/ShowResults/{query}/{exact}", // URL with parameters
                new { controller = "Search", action = "ShowResults", lng = UrlParameter.Optional, exact = UrlParameter.Optional } // Parameter defaults
            );
            routes.MapRoute(
            "Schedule", // Route name
            "{lng}/schedule/{ch_name}/{ch}/{id}", // URL with parameters
            new { controller = "Home", action = "GetProg", ch = UrlParameter.Optional,ch_name = UrlParameter.Optional, id = UrlParameter.Optional, lng = "am" } // Parameter defaults
            );

            routes.MapRoute(
                "Default", // Route name
                "{lng}/{controller}/{action}/{ch}/{id}", // URL with parameters
                new { controller = "Home", action = "Home", ch = UrlParameter.Optional, id = UrlParameter.Optional, lng = "am" } // Parameter defaults
            );

            routes.MapRoute(
                "Goto", //Route name
                "{lng}/{controller}/{action}/{ch}/{day}/{time}",
                new { controller = "Home", action = "GotoProg", ch = UrlParameter.Optional, day = UrlParameter.Optional, time = UrlParameter.Optional, lng = UrlParameter.Optional }
            );

           

        }

        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            RegisterRoutes(RouteTable.Routes);
        }
    }
}